package com.medreams.controller;

import com.medreams.domain.Test;
import com.medreams.service.impl.TestServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestServiceImpl testServiceImpl;


    @GetMapping("/list")
    public ModelAndView getTestList(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("hello","world");
        modelAndView.setViewName("success");
        List<Test> all = testServiceImpl.findAll();
        System.out.println(all);
        System.out.println(testServiceImpl.insertTest());
        return modelAndView;
    }

}
